const fs = require('fs')
const path = require('path')

let __instance = (function () {
    let instance
    return (newInstance) => {
        if (newInstance) instance = newInstance
        return instance
    }
}())

class Rsa {
    constructor() {
        if (__instance()) return __instance()
            this.private_key = fs.readFileSync(path.join(__dirname, 'rsa', '2048', 'private.pem'), {encoding: 'utf8'})
            this.public_key = fs.readFileSync(path.join(__dirname, 'rsa', '2048', 'public.pem'),  {encoding: 'utf8'})
        __instance(this)
    }
}
module.exports = new Rsa()